Skip to content

Comments

fixed homepage layout when quick-access is on/visible#2346

Open
rohitratannagar wants to merge 4 commits intoredhat-developer:mainfrom
rohitratannagar:fix-home-page-layout
Open

fixed homepage layout when quick-access is on/visible#2346
rohitratannagar wants to merge 4 commits intoredhat-developer:mainfrom
rohitratannagar:fix-home-page-layout

Conversation

@rohitratannagar
Copy link
Contributor

@rohitratannagar rohitratannagar commented Feb 18, 2026

Hey, I just made a Pull Request!

Description

  • Fixed home page layout when quickStart is visible
  • Added scrollBar in onboarding, software catalog and template section in home page

Fixes

UI Before Change

Screenshot 2025-08-08 at 9 57 12 AM Screenshot 2025-08-08 at 9 56 58 AM

UI After Change

Screen.Recording.2026-02-18.at.12.33.04.PM.mov

🧩 Container Query Support for Grid

Added two files useContainerQuery.ts in hooks and GridItem.ts in Utils for tracking the container width instead of tracking viewport width

1️⃣ useContainerQuery

A React hook that observes an element’s width using ResizeObserver and returns a container breakpoint:

xs | sm | md | lg | xl

  • Container-based (not viewport-based) responsiveness
  • Maps width to predefined breakpoints
  • Updates only when the breakpoint changes

2️⃣ containerGridItemSx

Generates an MUI sx object for Grid items using CSS Container Queries.

  • Supports xs | sm | md | lg | xl column props (1–12)
  • Converts columns to percentage widths
  • Inherits values from smaller breakpoints (MUI-style)
  • Uses @container (min-width: …) rules

3️⃣ GridItems.ts

GridItems.tsx composes the above utilities to provide a simple, container-aware Grid API.

  • Accepts breakpoint-based column props
  • Applies containerGridItemSx internally
  • Enables responsive layouts based on parent container width

✅ Result

  • True container-based Grid behavior
  • MUI-consistent breakpoint API

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Feb 18, 2026

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-dynamic-home-page workspaces/homepage/plugins/dynamic-home-page patch v1.10.6

Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
@rohitratannagar
Copy link
Contributor Author

/cc @its-mitesh-kumar

@ShiranHi
Copy link

Thank you @rohitratannagar for this improvement, this looks so much better!
One suggestion: should we hide the card images on smaller screens? It might help save valuable space for the main content.

Copy link
Member

@Eswaraiahsapram Eswaraiahsapram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rohitratannagar 🎉 ,

I added a few comments. PTAL

},

'@container (min-width: 1300px)': {
width: '20%',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we set each card’s width to 20%, four cards will only occupy 80% of the container. Because of this, there’s unused space on the right side when the screen width is larger than 1300px.

Image

},

'@container (min-width: 1200px)': {
width: '25%',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the width should be dynamic. When the entity image card is closed, we display four cards; when it’s open, we display three cards including the image card. So the width should adjust based on whether the entity image card is shown or hidden. With the current implementation, there’s empty space on the right side (refer attachment), which isn’t expected.

Image

Comment on lines 86 to 100
const responsiveGridItem2 = {
width: '100%',

'@container (min-width: 600px)': {
width: '50%',
},

'@container (min-width: 900px)': {
width: '25%',
},

'@container (min-width: 1200px)': {
width: '20%',
},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above — we need to make sure this works correctly for all cases.

Comment on lines 102 to 111
const responsiveGridItem3 = {
width: '100%',

'@container (min-width: 600px)': {
width: '50%',
},
'@container (min-width: 1200px)': {
width: '40%',
},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Comment on lines 49 to 62
const responsiveGridItem1 = {
width: '100%',

'@container (min-width: 600px)': {
width: '50%',
},

'@container (min-width: 900px)': {
width: '25%',
},

'@container (min-width: 1200px)': {
width: '20%',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — for Templates, we’re also showing four cards, and with the current logic, it results in empty space on the right side.

Image

…, OnboardingSection, and TemplateSection to use container queries instead of viewport media queries.

Signed-off-by: rohitratannagar <rohitratannagar2003@gmail.com>
@sonarqubecloud
Copy link

@rohitratannagar
Copy link
Contributor Author

Screen.Recording.2026-02-23.at.2.40.08.PM.mov
  • removed image card on smaller screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants